<?php
/**
 * @link https://ym2.cleverstone.top
 * @copyright Copyright (c) 2020 Yii Manager Software LLC
 */

namespace builder\form\util\control\xselect;

/**
 * 级联模式
 * @desc 该控件用于补充select2相关控件的不足
 * @author cleverstone
 * @since ym2.0
 * @see https://maplemei.gitee.io/xm-select/#/plugin/cascader
 */
class XselectCascader extends Xselect
{
    /**
     * Initialize
     */
    public function init()
    {
        $this->options['control'] = 'xselect_cascader';
        $this->options['pluginOptions']['cascader'] = [
            'show' => true, // 是否显示级联模式
        ];
    }

    /**
     * 间距
     * @param int $indent
     * @return $this
     */
    public function indent($indent)
    {
        $this->options['pluginOptions']['cascader']['indent'] = (int)$indent;
        return $this;
    }

    /**
     * 是否严格遵守父子模式
     * @param boolean $strict
     * @return $this
     */
    public function strict($strict)
    {
        $this->options['pluginOptions']['cascader']['strict'] = (boolean)$strict;
        return $this;
    }
}